﻿<Fluent:RibbonWindow x:Class="cocos.ribbon.mvvm.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:Fluent="clr-namespace:Fluent;assembly=Fluent"
        xmlns:AvDock="clr-namespace:Xceed.Wpf.AvalonDock;assembly=Xceed.Wpf.AvalonDock"
        xmlns:AvDockLayout="clr-namespace:Xceed.Wpf.AvalonDock.Layout;assembly=Xceed.Wpf.AvalonDock"
        xmlns:AvDockControls="clr-namespace:Xceed.Wpf.AvalonDock.Controls;assembly=Xceed.Wpf.AvalonDock"
        xmlns:local="clr-namespace:cocos.ribbon.mvvm"
        xmlns:Views="clr-namespace:cocos.ribbon.mvvm.Views"
		xmlns:ViewModels="clr-namespace:cocos.ribbon.mvvm.ViewModels"
        xmlns:Converters="clr-namespace:cocos.ribbon.mvvm.Converters"
        xmlns:Selectors="clr-namespace:cocos.ribbon.mvvm.Selectors"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:System="clr-namespace:System;assembly=mscorlib"
        Title="EntryWindow" Height="550" Width="725" Icon="pack://application:,,,/cocos.ribbon.mvvm;component/Resource/Icon/usergroup.ico">
    <Fluent:RibbonWindow.DataContext>
        <ViewModels:MainWindowViewModel/>
    </Fluent:RibbonWindow.DataContext>

    <Grid x:Name="mTopLevelGrid">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Fluent:Ribbon Grid.Row="0" AutomaticStateManagement="True" x:Name="mRibbon">
        
            <Fluent:Ribbon.Menu>

                <Fluent:Backstage Background="Green" x:Name="mFileBackstage">
					
                    <Fluent:BackstageTabControl x:Name="mFileBackstageTab">
						
                        <Fluent:Button Header="Save"
                                       Icon="Resource\Icon\Save.png"
                                       Fluent:KeyTip.Keys="S"/>
                        <Fluent:Button Header="Save As" 
                                       Icon="Resource\Icon\Save.png" 
                                       Fluent:KeyTip.Keys="A" 
                                       Command="{x:Static local:MainWindow.New1}" />
                        <Fluent:BackstageTabItem Header="TEST"
                                                 Content="Hello">

                            <Fluent:BackstageTabItem.ContentTemplate>

                                <DataTemplate>

                                    <Grid>
                                        <TextBox Text="{Binding Mode=OneWay}" />
                                    </Grid>
                                </DataTemplate>

                            </Fluent:BackstageTabItem.ContentTemplate>

                        </Fluent:BackstageTabItem>

                        <Fluent:SeparatorTabItem Header="Separator" />

                        <Fluent:BackstageTabItem Header="Info"
                                                 Fluent:KeyTip.Keys="E"
                                                 IsEnabled="False">
                            <ScrollViewer>
                                <Grid Height="400"
                                      Background="Red">
                                    <ListBox Width="100"
                                             Height="100"
                                             VerticalAlignment="Top"
                                             HorizontalAlignment="Left">
                                        <ListBoxItem>1</ListBoxItem>
                                        <ListBoxItem>2</ListBoxItem>
                                        <ListBoxItem>3</ListBoxItem>
                                        <ListBoxItem>4</ListBoxItem>
                                        <ListBoxItem>5</ListBoxItem>
                                        <ListBoxItem>6</ListBoxItem>
                                        <ListBoxItem>7</ListBoxItem>
                                        <ListBoxItem>8</ListBoxItem>
                                        <ListBoxItem>9</ListBoxItem>
                                        <ListBoxItem>10</ListBoxItem>
                                    </ListBox>
                                    <Fluent:ComboBox SelectedIndex="1">
                                        <ComboBoxItem>1</ComboBoxItem>
                                        <ComboBoxItem>2</ComboBoxItem>
                                        <ComboBoxItem>3</ComboBoxItem>
                                        <ComboBoxItem>4</ComboBoxItem>
                                        <ComboBoxItem>5</ComboBoxItem>
                                    </Fluent:ComboBox>
                                </Grid>
                            </ScrollViewer>
                        </Fluent:BackstageTabItem>

                        <Fluent:BackstageTabItem Header="Recent"
                                                 Fluent:KeyTip.Keys="R">
                            <TabControl Margin="20,5,20,5"
                                        Style="{DynamicResource InnerBackstageTabControlStyle}">
                                <Fluent:SeparatorTabItem Header="Test1" />
                                <TabItem Header="1">

                                </TabItem>
                                <TabItem Header="2">

                                </TabItem>
                                <TabItem Header="3">

                                </TabItem>
                                <Fluent:SeparatorTabItem Header="Test2" />
                                <TabItem Header="4">

                                </TabItem>
                            </TabControl>
                        </Fluent:BackstageTabItem>

                        <Fluent:SeparatorTabItem />
                        <Fluent:BackstageTabItem Header="New"
                                                 Fluent:KeyTip.Keys="N">
                            <Grid Background="#550000FF"
                                  Opacity="1"
                                  Margin="50"
                                  MinWidth="0"
                                  Width="Auto"
                                  HorizontalAlignment="Stretch">
                                <TextBlock HorizontalAlignment="Left"
                                           MinWidth="0"
                                           TextWrapping="Wrap"
                                           Foreground="Black">This is long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long text</TextBlock>
                                <Fluent:Button IsDefinitive="True"
                                               IsEnabled="True"
                                               Style="{DynamicResource ButtonBackstageStyle}"
                                               HorizontalAlignment="Left"
                                               Icon="Resource\Icon\Paste.png"
                                               LargeIcon="Resource\Icon\PasteLarge.png">123</Fluent:Button>
                                <Fluent:DropDownButton Header="123"
                                                       HorizontalAlignment="Right"
                                                       Icon="Resource\Icon\Paste.png"
                                                       LargeIcon="Resource\Icon\PasteLarge.png"></Fluent:DropDownButton>
                                <Fluent:ComboBox VerticalAlignment="Bottom">
                                    <TextBlock Text="1" />
                                    <TextBlock Text="2" />
                                    <TextBlock Text="3" />
                                    <TextBlock Text="4" />
                                    <TextBlock Text="5" />
                                </Fluent:ComboBox>
                                <Fluent:Spinner Value="1"
                                                Format="0"
                                                InputWidth="50"
                                                Header="Lala"
                                                HorizontalAlignment="Right"
                                                VerticalAlignment="Bottom"></Fluent:Spinner>
                            </Grid>
                        </Fluent:BackstageTabItem>
                        <Fluent:BackstageTabItem Header="Print"
                                                 Fluent:KeyTip.Keys="P">
                            <Grid Background="Yellow"
                                  Opacity="0.3"
                                  Margin="50" />
                        </Fluent:BackstageTabItem>
                        <Fluent:Button Header="Exit"
                                       Icon="Resource\Icon\Exit.png"
                                       Fluent:KeyTip.Keys="X"
                                       Command="ApplicationCommands.Close" />
                    </Fluent:BackstageTabControl>
                </Fluent:Backstage>
            </Fluent:Ribbon.Menu>
                
            <Fluent:Ribbon.QuickAccessItems>
                <Fluent:QuickAccessMenuItem Target="{Binding ElementName=pasteButton}"
                                            IsChecked="True" />
                <Fluent:QuickAccessMenuItem Target="{Binding ElementName=cutButton}"
                                            IsChecked="True" />
                <Fluent:QuickAccessMenuItem Target="{Binding ElementName=copyButton}" />
            </Fluent:Ribbon.QuickAccessItems>

            <Fluent:RibbonTabItem   x:Name="mHomeTabItem"
                                    Header="Home"
                                    Fluent:KeyTip.Keys="H"
                                    ToolTip="Regular Tool Tip"
                                    ReduceOrder="Font, Font, Font, Font,B,A,A,A,(A),(A),(A),Clipboard,Font,B,B,(A),C,(A),(A)">
                <Fluent:RibbonGroupBox Icon="pack://application:,,,/cocos.ribbon.mvvm;component/Resource/Icon/Default.png"
                                       Fluent:KeyTip.Keys="C"
                                       x:Name="Clipboard"
                                       Header="Clipboard"
                                       IsLauncherVisible="True"
                                       LauncherKeys="ZB">
                    <Fluent:SplitButton x:Name="pasteButton"
                                        Fluent:KeyTip.Keys="V"
                                        Header="Paste"
                                        Icon="Resource\Icon\Paste.png"
                                        LargeIcon="Resource\Icon\PasteLarge.png"
                                        Fluent:RibbonAttachedProperties.RibbonSizeDefinition="Large"
                                        Command="Paste">
                        <Fluent:SplitButton.ToolTip>
                            <Fluent:ScreenTip Title="Paste (Ctrl+V)"
                                              Text="Paste the contents of the Clipboard."
                                              Width="190" />
                        </Fluent:SplitButton.ToolTip>
                        <Fluent:Gallery ScrollViewer.VerticalScrollBarVisibility="Hidden"
                                        Orientation="Horizontal"
                                        GroupBy="Tag"
                                        Selectable="False"
                                        ItemWidth="32"
                                        ItemHeight="32">
                            <Fluent:Gallery.ItemContainerStyle>
                                <Style TargetType="{x:Type Fluent:GalleryItem}"
                                       BasedOn="{StaticResource {x:Type Fluent:GalleryItem}}">
                                    <Setter Property="Fluent:GalleryItem.Command" Value="Paste" />
                                </Style>
                            </Fluent:Gallery.ItemContainerStyle>
                            <Image Source="Resource\Icon\PasteImage.png"
                                   Width="24"
                                   Height="24"
                                   Fluent:KeyTip.Keys="K"
                                   Tag="Paste Options:" />
                            <Image Source="Resource\Icon\PasteText.png"
                                   Width="24"
                                   Height="24"
                                   Fluent:KeyTip.Keys="M"
                                   Tag="Paste Options:" />
                            <Image Source="Resource\Icon\PasteTextOnly.png"
                                   Width="24"
                                   Height="24"
                                   Fluent:KeyTip.Keys="T"
                                   Tag="Paste Options:" />
                            <Image Source="Resource\Icon\PasteFormating.png"
                                   Width="24"
                                   Height="24"
                                   Fluent:KeyTip.Keys="L"
                                   Tag="Paste Options:" />
                            <Image Source="Resource\Icon\PasteSourceFormating.png"
                                   Width="24"
                                   Height="24"
                                   Fluent:KeyTip.Keys="E"
                                   Tag="Paste Options:" />
                        </Fluent:Gallery>
                        <Fluent:MenuItem Header="Paste Special..."
                                         Fluent:KeyTip.Keys="S"
                                         Command="{x:Static local:MainWindow.CustomRoutedCommand}">
                            <Fluent:MenuItem.ToolTip>
                                <Fluent:ScreenTip Title="Paste Special"
                                                  Text="This ScreenTip is attached to menu item" />
                            </Fluent:MenuItem.ToolTip>
                        </Fluent:MenuItem>
                        <Separator />
                        <Fluent:MenuItem Header="Set Default Paste..."
                                         Fluent:KeyTip.Keys="A"
                                         IsSplited="True"
                                         Command="Paste">
                            <Fluent:MenuItem Header="1"/>
                            <Fluent:MenuItem Header="2"
                                             Command="Paste"></Fluent:MenuItem>
                        </Fluent:MenuItem>
                        <Fluent:MenuItem Header="Paste now"
                                         Command="Paste"></Fluent:MenuItem>
                    </Fluent:SplitButton>
                    <Fluent:Button x:Name="cutButton"
                                   Fluent:KeyTip.Keys="X"
                                   Header="Cut"
                                   Icon="Resource\Icon\Cut.png"
                                   Fluent:RibbonAttachedProperties.RibbonSizeDefinition="Middle,Small"
                                   Command="Cut">
                        <Fluent:Button.ToolTip>
                            <Fluent:ScreenTip Title="Cut (Ctrl+X)"
                                              Text="Cut the contents to the Clipboard."
                                              DisableReason="Cut is currently not available."
                                              Width="190" />
                        </Fluent:Button.ToolTip>
                    </Fluent:Button>
                    <Fluent:Button x:Name="copyButton"
                                   Fluent:KeyTip.Keys="C"
                                   Header="Copy"
                                   Icon="Resource\Icon\Copy.png"
                                   Fluent:RibbonAttachedProperties.RibbonSizeDefinition="Middle,Small"
                                   Command="Copy" />
                </Fluent:RibbonGroupBox>
            </Fluent:RibbonTabItem>
            
        </Fluent:Ribbon>
        
        <AvDock:DockingManager Grid.Row ="1" x:Name="mDockingManager"
                AnchorablesSource="{Binding Tools}"  
				DocumentsSource="{Binding Documents}"
				ActiveContent="{Binding ActiveDocument, Mode=TwoWay, Converter={x:Static Converters:ActiveDocumentConverter.Instance}}" >
            <AvDock:DockingManager.LayoutItemContainerStyleSelector>
                <Selectors:PanelsStyleSelector>
                    <Selectors:PanelsStyleSelector.ToolStyle>
                        <Style TargetType="{x:Type AvDockControls:LayoutAnchorableItem}">
                            <Setter Property="Title" Value="{Binding Model.DisplayName}"/>
                            <Setter Property="IconSource" Value="{Binding Model.Icon}"/>
                            <Setter Property="Visibility" Value="{Binding Model.IsVisible, Mode=TwoWay, Converter={x:Static Converters:BoolToVisibilityConverter.Instance}, ConverterParameter={x:Static Visibility.Hidden}}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                            <Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
                            <Setter Property="IsActive" Value="{Binding Model.IsActive, Mode=TwoWay}"/>
                        </Style>
                    </Selectors:PanelsStyleSelector.ToolStyle>
                    <Selectors:PanelsStyleSelector.DocumentStyle>
                        <Style TargetType="{x:Type AvDockControls:LayoutItem}">
                            <Setter Property="Title" Value="{Binding Model.DisplayName}"/>
                            <Setter Property="ToolTip" Value="{Binding Model.DisplayName}"/>
                            <Setter Property="CloseCommand" Value="{Binding Model.CloseCommand}"/>
                            <Setter Property="IconSource" Value="{Binding Model.Icon}"/>
                            <Setter Property="ContentId" Value="{Binding Model.ContentId}"/>
                            <Setter Property="IsSelected" Value="{Binding Model.IsSelected, Mode=TwoWay}"/>
                        </Style>
                    </Selectors:PanelsStyleSelector.DocumentStyle>
                </Selectors:PanelsStyleSelector>
            </AvDock:DockingManager.LayoutItemContainerStyleSelector>
            
            <AvDockLayout:LayoutRoot>
                <AvDockLayout:LayoutPanel Orientation="Vertical">
                    <AvDockLayout:LayoutDocumentPane/>
                    <AvDockLayout:LayoutAnchorablePane Name="ToolsPane" DockHeight="150">
                    </AvDockLayout:LayoutAnchorablePane>
                </AvDockLayout:LayoutPanel>
            </AvDockLayout:LayoutRoot>
        </AvDock:DockingManager>
        
        <Fluent:StatusBar Grid.Row ="2" x:Name="mStatusBarPanel">
            
        </Fluent:StatusBar>
        
    </Grid>
</Fluent:RibbonWindow>
